<template>
    <div>
        <div>
            <table>
                <tr>
                    <td>课程名称</td>
                    <td>课程价格</td>
                    <td>购买人数</td>
                    <td>操作</td>
                </tr>
                <tr v-for="(i,j) in item" :key="j">
                    <td>{{i.kecheng_name}}</td>
                    <td>{{i.price}}</td>
                    <td>{{i.number}}</td>
                    <td>
                        <button @click="tiao()">购买</button>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    name:'showke',
    data() {
        return {
            item:[],

        }
    },
    methods: {
        huo(){
            axios({
                url:'http://127.0.0.1:8000/zhouce/ke',
                method:'get'
            }).then(res=>{
                this.item = res.data
            })
        },
        tiao(){
            this.$router.push({path:'gou'})
        }
    },
    created() {
        this.huo()
    }
}
</script>

<style scoped>

</style>
